#!/usr/bin/env bash
set -euo pipefail

# install classic notebook extensions
jupyter nbextension enable --py widgetsnbextension --sys-prefix

# install jupyterlab extensions
jupyter labextension install --clean \
        @jupyter-widgets/jupyterlab-manager \
        dask-labextension \
        @pyviz/jupyterlab_pyviz \
        jupyterlab-videochat
        
# FIXME: Move this when environment.yml supports installing from pip
pip install --no-cache jupyter-videochat
jupyter serverextension enable --sys-prefix jupyter_videochat

# ====== cleanup labextension install =======
rm -rf ${HOME}/.cache ${HOME}/.npm ${HOME}/.yarn
rm -rf /opt/conda/share/jupyter/lab/staging
find /opt/conda -follow -type f -name '*.js.map' -delete

# ====== setup ipython conifiguration ======
mkdir /etc/ipython
cp /opt/jupyterlab/ipython_config.py /etc/ipython/ipython_config.py
